<?php


namespace app\home\controller;


use app\admin\common\Lunar;
use app\admin\model\Admin;
use think\facade\View;
use think\Request;

class Index
{
    public function index(Request $request)
    {
        $username = $request->get('username');
        $admin = Admin::where('username', trim($username))->find();
        $lunar = new Lunar();
        if ($admin['lunar'] == 1) {
            $day = explode('-', $admin['birthday']);
            $brithday = $lunar->convertLunarToSolar(date('Y'), $day[0], $day[1]);
        } else {
            $brithday = date('Y') . '-' . $admin['birthday'];
        }
        View::assign('name', $admin['nickname']);
        View::assign('pass', $brithday);
        return View::fetch();
    }

    public function login(Request $request)
    {
        View::assign('name', $request->param('name'));
        View::assign('pass', $request->param('pass'));
        return View::fetch();
    }

    public function birthday()
    {
        return View::fetch();
    }

    public function cake()
    {
        return View::fetch();
    }

    public function memories()
    {
        return View::fetch();
    }
}